#include <stdio.h>

void exchange1(int x,int y)
{
	int tmp = 0;
	tmp = x;
	x = y;
	y = tmp;	
}

void exchange2(int* x,int* y)
{
	// x  y   *x  *y
	int* tmp = NULL;
	tmp = x;
	x = y;
	y = tmp;	
}

void exchange(int* x,int* y)
{
	// x  y   *x  *y
	int tmp = 0;
	tmp = *x;  
	*x = *y;
	*y = tmp;	
}

int main()
{
	int a = 6;
	int b = 7;
	
//	int* p1 = &a;
//	int* p2 = &b;
	
	printf("a = %d\n",a);
	printf("b = %d\n",b);
	
//	exchange1(a,b);
//	exchange2(p1,p2);
//	exchange(p1,p2);
	exchange(&a,&b);
	 
	printf("a = %d\n",a);
	printf("b = %d\n",b);	

	return 0;
}

